const executeFunction = function() {
    try {
        // 清空所有图片的 src 属性，阻止图片加载
        // Array.from(document.getElementsByTagName('img')).forEach(img => {
        //     img.src = '';
        //     elementRemove(img);
        // });
        
        // 清空特定的脚本 src 属性
        // const scriptKeywords = ['login', 'index', 'daohang', 'grey', 'jquery', 'r.img.cctvpic.com'];
        // Array.from(document.getElementsByTagName('script')).forEach(script => {
        //     if (scriptKeywords.some(keyword => script.src.includes(keyword))) {
        //         // script.src = '';
        //         elementRemove(script);
        //     }
        // });
        
        // 清空具有特定 class 的 iframe 内容
        const cleanIframeClassNames = ['tj_iframe'];
        Array.from(document.getElementsByTagName('iframe')).forEach(element => {
            if (cleanIframeClassNames.some(keyword => element.className.includes(keyword))) {
                // element.innerHTML = '';
                elementRemove(element);
            }
        });
        
        // 清空具有特定 class 的 div 内容
        const cleanDivClassNames = ['newmap', 'newtopbz', 'newtopbzTV', 'column_wrapper',
        'vspace', 'video_btnBar', 'floatNav', 'footnew',
        'ggcontainer', 'md', 'login', 'page_head', 'page_bottom',
        'headernew', 'share', 'xuqiu', 'lanmujiansuo', 'footer'];
        Array.from(document.getElementsByTagName('div')).forEach(element => {
            if (cleanDivClassNames.some(keyword => element.className.includes(keyword))) {
                // element.innerHTML = '';
                elementRemove(element);
            }
        });
    
        // 设置具有特定 class 的 style 内容
        const cleanStyleClassNames = ['playingVideo', 'video_left', 'video_flash', 'control_bar_player',
        'page_wrap', 'video_box'];
        Array.from(document.getElementsByTagName('div')).forEach(element => {
            if (cleanStyleClassNames.some(keyword => element.className.includes(keyword))) {
                element.style.width = '100vw';
                element.style.height = '100vh';
            }
            if (element.className.includes('page_wrap')) {
                // element.style.minWidth = 'auto';
                // element.style.maxWidth = 'none';
                element.setAttribute('style', 'min-width: auto; max-width: none;');
            }
        });
        let controlBarPlayer = document.getElementById('control_bar_player');
        if (controlBarPlayer) {
        controlBarPlayer.setAttribute('style', 'display: none; visibility: hidden; opacity: 0;');
        }
        if (document.body) {
            document.body.setAttribute('style', 'min-width: auto;');
        }
    } catch (error) {
    console.log("jsError:" + error);
    }
    
    // 执行周期
    executionCycle();
}

document.addEventListener('DOMContentLoaded', function() {
    // console.log('DOM完全加载和解析完成');
    autoFullscreen('player_pagefullscreen_player');
});

executeFunction();